<div id="col1" class="w233">
    <div class="box_welcome">
        <div class="box_welcome_top"><h4>Kategori</h4></div>
        
        <!-- Categories menu -->
        <?php echo $category; ?>
        
        <div class="box_welcome_bottom"></div>
    </div>
    
    <?php if($product_total) { ?>
        <div class="p10t">
            <div class="box_welcome_top"><h4>Filter</h4></div>
            <div class="size_filter">
                <div class="sizes">                      
                    <?php $row = 1; $k = 0; $length = count($attributes); ?>
                    <?php foreach ($attributes as $attr_type_key => $attribute_type) { ?> 
                        <?php 
                        $row = 1- $row; $k++;                    
                        if($k == $length){
                            if($length == 1){
                                $row = '_last'; 
                            }
                            else{
                                $row = 1;    
                            }
                        } 
                        ?>   
                        <div class="attr_type<?php echo $row; ?>">
                            <h5 class="size_attr_name">  
                                <?php echo $attr_type_key; ?>   
                                <?php if(1==0){ ?>
                                    <a class="size_attr_clear savn" href="<?php echo $attributes_reset; //attributes_href; ?>"><span><u>Nulstil</u></span></a>
                                <?php } ?>
                            </h5> 
                            <?php foreach ($attribute_type as $attribute) { ?>                         
                                <div class="size_av_wrap savw<?php echo $attribute['attribute_id']; ?>">                                                                      
                                    <?php foreach($attribute['attribute_values'] as $attribute_item){ ?>                                   
                                        <div class="size_av">
                                            <?php if($attribute_item['selected']){ ?>
                                                <input type="checkbox" class="av_filter" name="attribute[]" value="<?php echo $attribute_item['value_id']; ?>" rel="<?php echo $attribute['href']; ?>" alt="<?php echo $attribute['attribute_id']; ?>" checked="checked" />
                                            <?php }else{ ?>
                                                <input type="checkbox" class="av_filter" name="attribute[]" value="<?php echo $attribute_item['value_id']; ?>" rel="<?php echo $attribute['href']; ?>" alt="<?php echo $attribute['attribute_id']; ?>" />
                                            <?php } ?>
                                            <span class="size_av_name"><?php echo $attribute_item['name']; ?></span><br />                                        
                                        </div>
                                    <?php } ?>
                                </div>    
                            <?php } ?>                   
                            <h5 class="size_attr_name1">
                                <?php if(!empty($attributes)){ ?>
                                    <a class="size_attr_all" rel="<?php echo $k; ?>" alt="<?php echo $attr_type_key; ?>" href="#"><span><u><?php echo 'Se alle ' . mb_strtolower($attr_type_key, 'UTF-8'); ?></u></span></a>
                                <?php } ?>
                                <?php if(!empty($attributes) && $attribute['filtered']){ ?>                        
                                    <a class="size_attr_clear" href="<?php echo $attribute['reset_link']; //attributes_href; ?>" style="float:right; margin-right:10px;"><span><u>Nulstil</u></span></a>                        
                                <?php } ?>
                            </h5> 
                        </div>  
                        
                        <!-- filter dialog -->
                        <div id="filter_by_attribute<?php echo $k; ?>" class="filter_by_attribute" style="min-width:670px;">
                            <div class='header'><span><?php echo 'Se alle ' . mb_strtolower($attr_type_key, 'UTF-8'); ?></span></div>
                            <div class='message'>
                                <?php foreach ($attribute_type as $attribute) { ?> 
                                    <div class="size_filter_dialog"> 
                                        <h5 class="size_attr_name1"><?php //echo $attribute['name'] ; ?></h5>
                                        <ul class="size_list_av">                                                       
                                            <?php foreach($attribute['attribute_values'] as $attribute_item){ ?>                      
                                                <li>
                                                    <input type="checkbox" class="av_filter" name="attribute[]" value="<?php echo $attribute_item['value_id']; ?>" alt="<?php echo $attribute['attribute_id']; ?>" /><span class="size_av_name"><?php echo $attribute_item['name']; ?></span><br />                                        
                                                </li>
                                            <?php } ?>                                               
                                        </ul>
                                    </div>
                                <?php } ?>
                            </div>
                            
                            <div class='buttons'>         
                                <div id="button_cancel" class='cancel simplemodal-close'>Annuller</div>
                                <div id="button_continue" class='continue'>Se valgte</div>
                            </div>
                            <br/>
                        </div>                      
                    <?php } ?> 
                </div>
            </div>                           
            <div class="size_filter_bottom"></div>
        </div>
    <?php } ?>
    
    <?php //echo $newsletter; ?>   
<!--
    <div class="p10t">
        <a target="_blank" href="http://www.trustpilot.dk/review/havhokeren.dk">
            <img src="catalog/view/theme/<?php echo $template; ?>/images/trustpilot2.png" alt="" />
        </a>
    </div>
-->    
    <div class="p10t p10b">
        <!-- a href="http://www.facebook.com/#!/pages/Gilleleje-Denmark/Havhokeren/120681221280479" target="_blank"><img src="catalog/view/theme/<?php echo $template; ?>/images/banner_facebook.jpg" /></a -->
        <div class="fb-like-box" data-href="http://www.facebook.com/Havhokeren" data-height="265" data-width="240" data-show-border="false" data-show-faces="true" data-stream="false" data-header="false"></div>
    </div>
    <!--
    <div class="p10t"> <a href="http://twitter.com/" target="_blank"><img src="catalog/view/theme/<?php echo $template; ?>/images/banner_twitter.jpg" /></a></div>
    <div class="p10t"> <img src="catalog/view/theme/<?php echo $template; ?>/images/banner_left1.png"/></div>
    -->
</div>
     
<script type="text/javascript"><!--
jQuery('.size_av input.av_filter').click(function(){
    var href = jQuery(this).attr('rel'); 
    
    jQuery('.size_av input.av_filter').each(function(){
        if(jQuery(this).is(':checked')){        
            href = href + '&attribute[][' + jQuery(this).attr('alt') + ']=' + jQuery(this).attr('value');
        }
    });
    
    var html = '';
    html =  '<div id="filter_by_attribute-overlay" class="simplemodal-overlay" style="opacity: 0.5; height: 912px; width: 1263px; position: fixed; left: 0px; top: 0px; z-index: 1001;">'
    html +=     '<div style="position: fixed; top: 40%; left: 45%; display: block;">';
    //html +=         '<img src="catalog/view/theme/<?php echo $template; ?>/images/ajax_loader.gif">'
    html +=           '<h4 style="font-size:18px; color:#FFF">Søgning...</h4>';
    html +=     '</div>';
    html += '</div>';
    jQuery('#page_margins').append(html);    
    
    window.location = href;
});

jQuery('.size_av input.av_filter_sel').click(function(){
    var href = jQuery(this).attr('rel');
    
    jQuery('.size_av input.av_filter_sel').each(function(){
        if(jQuery(this).is(':checked')){
            href += '&attribute[][' + jQuery(this).attr('alt') + ']=' + jQuery(this).attr('value');
        }
    });
    
    window.location = href; 
});

jQuery('a.size_attr_clear').click(function(even){
    var html = '';
    html =  '<div id="filter_by_attribute-overlay" class="simplemodal-overlay" style="opacity: 0.5; height: 912px; width: 1263px; position: fixed; left: 0px; top: 0px; z-index: 1001;">'
    html +=     '<div style="position: fixed; top: 40%; left: 45%; display: block;">';
    //html +=         '<img src="catalog/view/theme/<?php echo $template; ?>/images/ajax_loader.gif">'
    html +=           '<h4 style="font-size:18px; color:#FFF">Søgning...</h4>';
    html +=     '</div>';
    html += '</div>';
    jQuery('#page_margins').append(html);
});

jQuery('a.size_attr_all').click(function(even){
    even.preventDefault();
    
    filterByAttribute(jQuery(this).attr('alt'), jQuery(this).attr('rel'), continueFilter);
    return false;
});

function continueFilter(){
    var href = '<?php echo $attributes_href; ?>';
    var apply = false;
    
    jQuery('ul.size_list_av input.av_filter').each(function(){
        if(jQuery(this).is(':checked')){
            apply = true;
            href += '&attribute[][' + jQuery(this).attr('alt') + ']=' + jQuery(this).attr('value');
        }
    });
    
    if(apply){
        window.location = href;
    }
}

//-->
</script>